home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 009a / snpd0493.zip / FMEMOPS.C < prev    next >
C/C++ Source or Header  |  1993-04-05  |  1KB  |  52 lines

  1. /*
  2. **  FMEMOPS.C - Emulate MSC's far memory functions in BC++ & ZTC++
  3. **
  4. **  Original Copyright 1988-1992 by Bob Stout as part of
  5. **  the MicroFirm Function Library (MFL)
  6. **
  7. **  This subset version is hereby donated to the public domain.
  8. */
  9.  
  10. #include <stdlib.h>
  11.  
  12. #if defined(__TURBOC__) || defined(__ZTC__)
  13.  
  14. #ifdef __TURBOC__
  15.  #define FAR far
  16. #else
  17.  #define FAR _far
  18. #endif
  19.  
  20. void FAR * _fmemcpy(void FAR *dest, void FAR *src, size_t count)
  21. {
  22.       void FAR *target =  dest;
  23.  
  24.       for ( ; count; --count)
  25.       {
  26.             *dest++ = *src++;
  27.       }
  28.       return target;
  29. }
  30.  
  31. void FAR * _fmemmove(void FAR *dest, void FAR *src, size_t count)
  32. {
  33.       void FAR *target =  dest;
  34.  
  35.       if (src >= dest)
  36.             _fmemcpy(dest, src, count);
  37.       else  for (dest += count, src  += count ;count ;--count)
  38.                   *(--dest) = *(--src);
  39.       return target;
  40. }
  41.  
  42. void _fmemset(void FAR *dest, int ch, size_t count)
  43. {
  44.       void FAR *target =  dest;
  45.  
  46.       for ( ; count; --count)
  47.             *(unsigned char FAR *)dest++ = (unsigned char) ch;
  48.       return target;
  49. }
  50.  
  51. #endif
  52.